package net.mukia.repository.impl.hibernate;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import net.mukia.model.AccountToken;
import net.mukia.repository.AccountTokenRepository;

@Repository("accountTokenRepository")
public class HibernateAccountTokenRepository extends BaseRepository<AccountToken> implements AccountTokenRepository {

	@Override
	public List<AccountToken> selectAll(AccountToken accoutToken) {
		Criteria criteria = this.getSession().createCriteria(AccountToken.class)
		.add(Restrictions.eq("rToken.secret", accoutToken.getrToken().getSecret()))
		.add(Restrictions.eq("rToken.token",accoutToken.getrToken().getToken()));
		return criteria.list();
	}
	
}
